# -*- coding: utf-8 -*-
from django import forms
from django.utils.html import format_html


class RichText(forms.Textarea):
    class Media:
        css = {
            'all': ('https://cdn.quilljs.com/1.3.0/quill.snow.css',)
        }
        js = ('https://cdn.quilljs.com/1.3.0/quill.js',)

        def render_js(self):
            return [
                format_html(
                    '<script type="text/javascript" src="{}"></script>',
                    self.absolute_path(path)
                ) for path in self._js
                ]
